/**
 * @file   algorithm.hpp
 * @author Kimmo Luoma <kimmo@PHOTON3>
 * @date   Mon Sep 10 15:04:12 2012
 * 
 * @brief  NMQJ algorithm for one times tep
 * 
 * 
 */
#ifndef ALGORITHM_HPP
#define ALGORITHM_HPP
#include "transition_map.hpp"
#include "effective_ensemble.hpp"
#include "channels.hpp"
#include "output.hpp"
#include "random.hpp"
#include <boost/random.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <cmath>
#include <ctime>
#define DEBUG 0
using namespace boost::numeric::ublas;
class algorithm{
private:
  double dt;
  int i;
  double T;
  MyRandom rng;
  vector<int> ensemble;
  vector<int> ensemble2;
  output out;
public:
  algorithm(double delta,double T0,int size,output& out0);
  //algorithm(double delta,double T0,int size,output& out0,unsigned seed);
  double get_time();
  void update_time();
  vector<double> probability(int n);
  vector<double> sigma(effective_ensemble& eff);
  void make_transition(int source,vector<int> target,vector<double> p);
  //double sample();
  void det_evol(effective_ensemble& eff,channels& chans);
  void jumps(effective_ensemble& eff,channels& chans,transition_map tmap[]);
  void apply(effective_ensemble& eff,channels& chans,transition_map tmap[]);
  output get_output();
  void print_to_files();
};
#endif
